package com.lzy.cloud.payment.remote;

import com.lzy.cloud.payment.remote.dtos.AccountWalletInfoDto;
import com.lzy.cloud.payment.remote.request.AccountWalletInfoRequest;
import com.lzy.framework.core.output.Result;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

@FeignClient(name = "lzy-cloud-account")
public interface AccountApi {

    /**
     * 根据会员id和平台id（shopId）获取该钱包id
     * @param memberId
     * @return
     */
    @RequestMapping(value = "account/find/by/memberid/and/platformid",method = RequestMethod.GET)
    Result findByMemberIdAndPlatformId(@RequestParam("memberId") Long memberId,@RequestParam("platformId") Long platformId);

    /**
     * 根据钱包id获取冻结金额
     * @param walletId
     * @return
     */
    @RequestMapping(value = "account/find/by/wallet/id/{walletId}",method = RequestMethod.GET)
    Result findByWalletId(@PathVariable("walletId") Long walletId);

    /**
     * 更新钱包冻结金额
     * @param accountWalletInfoRequest
     * @return
     */
    @RequestMapping(value = "account/update/blocked/wallet",method = RequestMethod.POST)
    Result updateBlockedWallet(AccountWalletInfoRequest accountWalletInfoRequest);

    /**
     * 根据钱包id获取可用余额
     * @param walletId
     * @return
     */
    @RequestMapping(value = "/select/available/by/wallet/id/{walletId}",method = RequestMethod.GET)
    Result selectAvailableAccount(@PathVariable("walletId") Long walletId);

    /**
     * 更新可用余额
     * @param accountWalletInfoDto
     * @return
     */
    @RequestMapping(value = "/update/by/primary/key",method = RequestMethod.POST)
    Result updateByPrimaryKey(AccountWalletInfoDto accountWalletInfoDto);
}
